home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Core / Includes / Toolbox.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  2.4 KB  |  92 lines  |  [TEXT/MPS ]

  1. // Toolbox.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __TOOLBOX__
  5. #define __TOOLBOX__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __MACONDITIONALMACROS__
  10. #include "MAConditionalMacros.h"
  11. #endif
  12.  
  13. // Toolbox
  14.  
  15. #ifndef __QUICKDRAW__
  16. #include <Quickdraw.h>
  17. #endif
  18.  
  19.  
  20. //----------------------------------------------------------------------------------------
  21. // CRGBColor
  22. //----------------------------------------------------------------------------------------
  23. class CRGBColor : public RGBColor
  24. {
  25. public:
  26.     // Constructors
  27.     
  28.     inline CRGBColor()
  29.     { }
  30.  
  31.     inline CRGBColor(unsigned short theRed, unsigned short theGreen, unsigned short theBlue)
  32.     {
  33.         red = theRed;
  34.         green = theGreen;
  35.         blue = theBlue;
  36.     }
  37.  
  38.     inline CRGBColor(const RGBColor& color)
  39.     { *this = *(CRGBColor*)&color; }
  40.  
  41.     //------------------------------------------------------------------------------------
  42.     // Copy and conversion operator methods
  43.     //------------------------------------------------------------------------------------
  44.     
  45.     // Used to create a toolbox type RGBColor* from our CRGBColor.  This is simply a type
  46.     // coercion!
  47.     
  48.     inline operator RGBColor*()
  49.     { return this; }
  50.     
  51.     inline operator const RGBColor*() const
  52.     { return this; }
  53.     
  54.     // Comparison operators
  55.     
  56.     Boolean operator ==(const CRGBColor& color) const;
  57.     inline Boolean operator !=(const CRGBColor& color) const
  58.     { return !(*this == color); }
  59.     
  60.     // Arithmetic, by another color
  61.     
  62.     CRGBColor operator +(const CRGBColor& color) const;
  63.     CRGBColor operator -(const CRGBColor& color) const;
  64.     CRGBColor operator *(const CRGBColor& color) const;
  65.     CRGBColor operator /(const CRGBColor& color) const;
  66.  
  67.     CRGBColor& operator +=(const CRGBColor& color);
  68.     CRGBColor& operator -=(const CRGBColor& color);
  69.     CRGBColor& operator *=(const CRGBColor& color);
  70.     CRGBColor& operator /=(const CRGBColor& color);
  71.     
  72.     // Arithmetic by a scalar
  73.     
  74.     CRGBColor operator +(const unsigned short a) const;
  75.     CRGBColor operator -(const unsigned short a) const;
  76.     CRGBColor operator *(const unsigned short a) const;
  77.     CRGBColor operator /(const unsigned short a) const;
  78.     
  79.     CRGBColor& operator +=(const unsigned short a);
  80.     CRGBColor& operator -=(const unsigned short a);
  81.     CRGBColor& operator *=(const unsigned short a);
  82.     CRGBColor& operator /=(const unsigned short a);
  83. };
  84.  
  85. //
  86. // miscellaneous calls that simplify coding just the teensiest little bit
  87. //
  88. inline void MoveToPt(Point p) { ::MoveTo(p.h, p.v); }
  89. inline void LineToPt(Point p) { ::LineTo(p.h, p.v); }
  90.  
  91. #endif
  92.